import com.zeng.controller.UserController;
import com.zeng.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author zeng
 * @data 2021/06/08 18:40
 */
public class Mytest {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext.xml");
        User user = context.getBean("user", User.class);
        System.out.println(user.name);
    }

    @Test
    public void UserControllerDemo(){
        //得到的只是@Bean返回的对象
        ApplicationContext context = new AnnotationConfigApplicationContext(UserController.class);
        String hello = context.getBean("Hello", String.class);
        System.out.println(hello);
    }
}
